import sys
import os
from loguru import logger

def init_logger():
    logger.add(sys.stdout, format="{time} {level} {message}", level="INFO")
    logdir = os.environ.get("LOGDIR", "./output/logdir/")
    if not os.path.exists(logdir):
        os.makedirs(logdir)
    logger.add(logdir + "/server.{time}.log", rotation="00:00",retention="30 days", enqueue=True)

init_logger()